package ualrcdg.client;

import java.util.ArrayDeque;

/**
 * This class creates a stack so the user may be able to undo/redo processes while playing a game. 
 * <br />An array deque is the data structure being used to implement the stack.
 */
public class GameStack
{
	ArrayDeque<String> stack = new ArrayDeque<String>();
	private final static String rootFSMid = "#ROOT_FSM_ID#";
	
	/**
	 * This constructor is a nullary constructor for the game stack.
	 */
	public GameStack()
	{
		
	}
	
	/**
	 * This method pops a state from the stack.
	 * @return the state
	 */
	public String popState()
	{
		if(stack.isEmpty() == false)
		{
			return stack.removeFirst();
		}
		else
		{
			return null;
		}
	}
	
	/**
	 * This method pushes a state onto the stack.
	 * @param state to be pushed onto the stack
	 */
	public void pushState(String state)
	{
		stack.add(state);
	}
	
	
}
